#
# Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
# and other contributors as indicated by the @author tags.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#!/bin/sh
set -e

# Script prepares all necessary jar files for zipkin tracing.
# Jar files will be located under target/lib directory.

rm -rf target
mkdir target
cd target

BRAVE_VERSION=3.9.1
ZIPKIN_VERSION=1.10.0

wget -P lib http://central.maven.org/maven2/io/zipkin/brave/brave-core/$BRAVE_VERSION/brave-core-$BRAVE_VERSION.jar
wget -P lib http://central.maven.org/maven2/io/zipkin/brave/brave-spancollector-http/$BRAVE_VERSION/brave-spancollector-http-$BRAVE_VERSION.jar
wget -P lib http://central.maven.org/maven2/io/zipkin/java/zipkin/$ZIPKIN_VERSION/zipkin-$ZIPKIN_VERSION.jar

git clone https://github.com/thelastpickle/cassandra-zipkin-tracing && cd cassandra-zipkin-tracing  && git checkout 46b8f3276e4fb10bc04336f5adfa259e7123ec0e
mvn install -DskipTests
cp target/*.jar ../lib
